package co.chonghao.ch_kuaichong_user.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

import co.chonghao.ch_kuaichong_user.bean.FragmentInfo;

/**
 * Created by admin on 2017/8/1.
 */

public class HomeAdapter extends FragmentStatePagerAdapter {
    private List<FragmentInfo> mShowitem = new ArrayList<>();
    public HomeAdapter(FragmentManager childFragmentManager, List<FragmentInfo> mShowitem) {
        super(childFragmentManager);
        this.mShowitem = mShowitem;

    }

    @Override
    public Fragment getItem(int position) {
        return mShowitem.get(position).fragment;
    }

    @Override
    public int getCount() {
        return mShowitem.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mShowitem.get(position).title;
    }
}
